chore: add conventional commits pre-commit hook#85
Conversation
📝 WalkthroughWalkthroughThe pull request introduces a pre-commit hook configuration that enforces Conventional Commits in the repository, paired with updated contribution guidelines that document the new development setup and commit message format requirements. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
172d053 to
ccfbf3d
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ccfbf3d to
d85856d
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
CONTRIBUTING.md (1)
45-97:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix MD040: add language tags to fenced code blocks.
Static analysis flags MD040 because the fenced code blocks at:
- Line 51 (Format template)
- Line 92 (BREAKING CHANGE example)
don’t specify a language. This is a quick doc maintainability fix and prevents future markdownlint failures.💡 Proposed change
-``` +```text <type>(optional scope): <description> [optional body] [optional footer(s)]...
-
+text
feat: change /chat response formatBREAKING CHANGE: response field "text" renamed to "content"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CONTRIBUTING.md` around lines 45 - 97, Add language tags to the two fenced code blocks that triggered MD040: the commit message format block containing "<type>(optional scope): <description> ... [optional footer(s)]" and the BREAKING CHANGE example block beginning with "feat: change /chat response format" so both fences use a language tag (e.g., ```text) to satisfy markdownlint; update those two fences accordingly.
🧹 Nitpick comments (1)
.pre-commit-config.yaml (1)
1-23: ⚡ Quick winConsider merge-commit handling (and verify linter CLI flag support).
With
conventional-precommit-linterrunning atcommit-msgand no merge-skip/exception config, local merges may be rejected due to default merge messages (e.g.,Merge branch ... into ...). You already documentgit commit --no-verifyin CONTRIBUTING.md, but it may not apply cleanly to all commit-creating commands (merge/cherry-pick/rebase), and the linter may also have a “skip merge commits” option.Please verify:
- Whether this linter supports an option to skip merge commits (or treat them as exempt), and
- That the provided
--types=...,--subject-min-length,--subject-max-length, and--allow-breakingflags match the linter’s expected CLI syntax for v1.11.0.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.pre-commit-config.yaml around lines 1 - 23, The commit-msg hook configuration for the conventional-precommit-linter (hook id: conventional-precommit-linter) may reject merge commits and/or be using incorrect CLI flags; verify whether v1.11.0 supports a "skip merge commits" or equivalent flag (or an allow/ignore pattern) and confirm the exact flag names/syntax for --types, --subject-min-length, --subject-max-length and --allow-breaking; if the linter supports skipping merges, update the hook args to include that flag (or add an explicit exempt pattern for merge commit messages), otherwise adjust the configuration to a supported flag syntax or add documentation instructing use of --no-verify for automated merges and rebases so that merge/cherry-pick/rebase workflows aren’t blocked (refer to the hook id conventional-precommit-linter and the current args list to locate where to change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@CONTRIBUTING.md`:
- Around line 45-97: Add language tags to the two fenced code blocks that
triggered MD040: the commit message format block containing "<type>(optional
scope): <description> ... [optional footer(s)]" and the BREAKING CHANGE example
block beginning with "feat: change /chat response format" so both fences use a
language tag (e.g., ```text) to satisfy markdownlint; update those two fences
accordingly.
---
Nitpick comments:
In @.pre-commit-config.yaml:
- Around line 1-23: The commit-msg hook configuration for the
conventional-precommit-linter (hook id: conventional-precommit-linter) may
reject merge commits and/or be using incorrect CLI flags; verify whether v1.11.0
supports a "skip merge commits" or equivalent flag (or an allow/ignore pattern)
and confirm the exact flag names/syntax for --types, --subject-min-length,
--subject-max-length and --allow-breaking; if the linter supports skipping
merges, update the hook args to include that flag (or add an explicit exempt
pattern for merge commit messages), otherwise adjust the configuration to a
supported flag syntax or add documentation instructing use of --no-verify for
automated merges and rebases so that merge/cherry-pick/rebase workflows aren’t
blocked (refer to the hook id conventional-precommit-linter and the current args
list to locate where to change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: e3eac864-3611-4424-8119-f50e6c0a67bb
📒 Files selected for processing (2)
.pre-commit-config.yamlCONTRIBUTING.md
|
LGTM |
Description
Adds a pre-commit hook to enforce the Conventional Commits specification on all commit messages. Uses the espressif/conventional-precommit-linter hook, which validates commit message format at the
commit-msgstage.Changes:
.pre-commit-config.yaml: new file with the conventional commits hook configured with allowed types, subject length limits, and breaking change supportCONTRIBUTING.md: added "Development setup" section with pre-commit install instructions and updated "Commit message conventions" with the enforced format, all allowed types, and examplesJira Ticket
RHAIENG-4066
Testing
make testpasses (run from the affected agent directory)Verified locally:
"updated stuff","chore: doc") are rejected"chore: add conventional commits pre-commit hook") passChecklist
.envor secret files are included in this PRReview Guidance
Review Guidance
.pre-commit-config.yaml— review the args to confirm the team is happy with the allowed types and subject length limits (min 10, max 72)--scopes: restrict to specific scopes (currently unrestricted)--body-max-line-length: limit body line length (currently unrestricted)--summary-uppercase: enforce uppercase first letter--scope-case-insensitive: allow uppercase in scopesruff.toml,.markdownlint.json) are in place.Related PRs
#80 (Tarun's Ruff linting and formatting — provides
ruff.tomlthat future pre-commit hooks will use)